package com.itheima.job;

import lombok.Data;

import java.util.Date;
import java.util.Objects;

public class TestDemo {
    private Student st;
    public static void main(String[] args) {
        Student s1 = new Student("张三", "男", 12);
        Student s2 = new Student("张三", "男", 12);
        System.out.println(s1.equals(s2));
    }

    public static void test(){

    }
}

@Data
class Student{
    private String name;
    private String sex;
    private int age;

    public Student() {
    }

    public Student(String name, String sex, int age) {
        this.name = name;
        this.sex = sex;
        this.age = age;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Student student = (Student) o;
        return age == student.age && Objects.equals(name, student.name) && Objects.equals(sex, student.sex);
    }
}

